{ "cells": [ { "cell_type": "markdown", "id": "d240914c", "metadata": {}, "source": [ "## List to Dictionary" ] }, { "cell_type": "code", "execution_count": 3, "id": "beb69f46", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[1, 2, 3, 4]" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "list1=[1,2,3,4]\n", "list1" ] }, { "cell_type": "code", "execution_count": 5, "id": "4fd8fcaa", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{1: 100, 2: 200, 3: 300, 4: 400}" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "{i:i*100 for i in list1} " ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.8" } }, "nbformat": 4, "nbformat_minor": 5 }